<template>
  <div class="table-name">
    <template v-if="type === 'Select' || type === 'Radio'">
      {{ row[column.prop] | dicDataName(column.dicData, column.props) }}
    </template>
    <template v-else-if="type === 'Checkbox'">
      <el-tag
        v-for="(item, index) in row[column.prop]"
        :key="index"
        style="margin-right: 5px"
        >{{ item | dicDataName(column.dicData, column.props) }}</el-tag
      >
    </template>
    <template v-else-if="type === 'Switchs'">
      {{ row[column.prop] ? "开" : "关" }}
    </template>
    <template v-else-if="type === 'uploadImg'">
      <el-image
        style="width: 50px; height: 50px"
        :src="row[column.prop]"
        :preview-src-list="[row[column.prop]]"
      >
      </el-image>
    </template>
    <template v-else>
      {{ row[column.prop] }}
    </template>
  </div>
</template>

<script>
export default {
  name: "table-name",
  props: {
    row: {
      type: Object,
      default: () => {},
    },
    column: {
      type: Object,
      default: () => {},
    },
  },
  filters: {
    dicDataName(val, dicData, props) {
      return dicData.filter((item) => item[props.value || "value"] == val)[0][
        props.label || "label"
      ];
    },
  },
  data() {
    return {
      type: "",
    };
  },
  created() {
    this.type = this.column.type;
  },
  methods: {},
};
</script>


<style scoped lang="less">
</style>
